package com.yb.nowcoder;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String str = sc.nextLine();
            if (!check(str)) {
                System.out.println("ERROR");
            }
            //判断是字母还是数字
            long sum = 0;
            char[] c = str.toCharArray();//转换为数组
            if (str.charAt(0) >= 97 && str.charAt(0) <= 122) {//字母
                for (int i = 0; i < c.length; i++) {
                    sum += (c[i] - 96) * Math.pow(26, c.length - i - 1);
                }
                System.out.println(sum);
            } else if (str.charAt(0) >= 48 && str.charAt(0) <= 57) {//数字
                long num = Long.parseLong(str);
                long mod;
                List<Long> list = new ArrayList<>();
                while (num != 0) {
                    mod = num % 26;
                    num = num / 26;
                    list.add(mod);
                }
                Collections.reverse(list);//逆序处理
                String result = "";
                for (int i = 0; i < list.size(); i++) {
                    result += String.valueOf((char) (list.get(i) + 96));
                }
                System.out.println(result);
            }
        }
    }

    public static boolean check(String s) {
        if (s.length() < 1 || s.length() > 6) {
            System.out.println("ERROR");
        }
        for (int i = 0; i < s.length(); i++) {
            if (!(s.charAt(i) >= 'a' && s.charAt(i) <= 'z') && !(s.charAt(i) >= '0' && s.charAt(i) <= '9')) {
                return false;
            }
        }
        return true;
    }
}
